<?php
    namespace app\admin\controller;
    use app\common\controller\Common as base;
    
    class Goods extends base{

        //新增商品
        public function goodsAdd()
        {
            $timeStr=date('Ymdhis',time());  //编号
            $time=date('Y-m-d h:i:s',time());
            $data=[
                "auth"=>input('auth',''), //操作人
                "creatTime"=>$time,
                "updateTime" => $time,
                "goodsCode"=>'G'.$timeStr
            ];
            var_dump($data);
        }

        //商品列表
        public function goodsList()
        {
            $res=db('goods') -> select();
            $res ? $this->resSuccess($res) : $this->resError(null); 
        }

        //商品详情
        public function goodsDetail()
        {
            $goodsId=input('goodsId');
            if(empty($goodsId)){
                $this->resError('商品不存在');
                return ;
            }
            $res=db('goods') -> where('id',$goodsId) -> select();
            $res ? $this->resSuccess($res) : $this-> resError(null);
        }
        
    }